package com.cgbl.cg.adapter

import android.view.View
import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.SizeUtils
import com.blankj.utilcode.util.SpanUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cgbl.cg.R
import com.cgbl.cg.utils.city.DoubleUtils
import com.robot.base.model.ConfirmOrderProductBean
import com.robot.base.model.ShopCartBean
import com.robot.base.utils.pic.ImageLoaderUtils

class ConfirmOrderProductAdapter :
    BaseQuickAdapter<ConfirmOrderProductBean, BaseViewHolder>(R.layout.app_item_confirm_order_product) {

    override fun convert(holder: BaseViewHolder, item: ConfirmOrderProductBean) {

//        SpanUtils.with(holder.getView(R.id.tv_name)).append(item.courseInfoDTO?.courseName ?: "")
//            .setLeadingMargin(SizeUtils.dp2px(34f), 0).setFontSize(14, true).create()

        holder.setText(R.id.tv_ori_price, ("￥" + item.price))
            .setText(R.id.tv_price, "￥${item.vipPrice ?: "0.00"}")
            .setText(R.id.tv_name, item.projectName ?: "")
            .setText(R.id.tv_desc, "仅需${DoubleUtils.replace(item.vipPrice)}元/月")
            .setText(R.id.tv_cover_title, item.projectName)
        holder.setGone(R.id.tv_desc, item.projectType != "3")
        holder.setGone(R.id.tv_price, item.projectType == "3")
        holder.setGone(R.id.tv_cover_title, item.projectType == "3")
        holder.setGone(R.id.tv_tag, item.projectType == "3")

        if (item.projectType == "3") {
            //会员订单
            ImageLoaderUtils.display(
                context, holder.getView(R.id.iv_cover), R.mipmap.ic_vip_order_cover
            )
        } else {
            ImageLoaderUtils.display(
                context, holder.getView(R.id.iv_cover), item.projectCover ?: ""
            )
        }
    }
}